package zsl.generator;

import java.io.IOException;
import zsl.utils.WordCount;
import zsl.utils.WordCountList;

public class UniDisWdListsGen extends WordListGenerator{
	
	public UniDisWdListsGen(int dictLen, long seed) throws IOException{
		super(dictLen, seed);
	}
	
	@Override
	public WordCountList generateWords(int numOfWord) {
		WordCountList wordList = new WordCountList(numOfWord);
		int [] numIndex = new int[numOfWord];
		for(int i=0;i<numOfWord;i++){
			numIndex[i] = i;
		}
		int curNum = 0;
		int curDictLen = numOfWord;
		for (int i = 0; i < numOfWord; i++) {
			curNum = randomLineGen.nextInt(curDictLen);
			wordList.add(new WordCount(dict[i], numIndex[curNum]));
			numIndex[curNum] = numIndex[curDictLen-1];
			curDictLen--;
		}
		
		return wordList;
	}
	
	public static void main(String[] args) throws IOException {
		WordListGenerator wg = new UniDisWdListsGen(10,1000L);
		System.out.println(wg.generateWords(10));
		System.out.println(wg.generateWords(10));
	}

}
